﻿<Window x:Class="CurrencyReference.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="156" Width="400">
    
    <Window.Resources>
        <Style x:Key="btnStyle1" TargetType="Label">
            <Setter Property="FontSize" Value="18"/>
            <Setter Property="FontStyle" Value="Italic"/>
        </Style>
    </Window.Resources>
    
    
    <Grid>
        <!--Grid for overall control-->
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="10" />
            <ColumnDefinition Width="3*" />
            <ColumnDefinition Width="5*" />
            <ColumnDefinition Width="10" />
            <!--for padding-->
            <ColumnDefinition Width="*" MinWidth="100" />
            <ColumnDefinition Width="10" />
        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>
            <RowDefinition Height="10" />
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
            <RowDefinition Height="10" />
        </Grid.RowDefinitions>

        <Label Content="Amount" Grid.Column="1" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Right" BorderThickness="0,0,10,0" Style="{StaticResource btnStyle1}" />
        <TextBox Name="txtAmount" Grid.Column="2" Grid.Row="1" VerticalAlignment="Center" TextChanged="Calculate" />
        <ComboBox Name="cbxCurrency" Grid.Column="4" Grid.Row="1" VerticalAlignment="Center" 
                  ItemsSource="{Binding Currencies}" SelectionChanged="Calculate" SelectedIndex="0">
            <ComboBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding CurrencySymbol}" />
                        <TextBlock Text="{Binding RateAgainstEuro, StringFormat=(\{0:0.00\})}" Margin="3,0,0,0" />
                    </StackPanel>
                </DataTemplate>
            </ComboBox.ItemTemplate>
        </ComboBox>

        <TextBox Name="txtResult" Grid.Column="2" Grid.Row="2" IsReadOnly="True" VerticalAlignment="Center" />
        <StackPanel Orientation="Vertical" Grid.Column="4" Grid.Row="2" VerticalAlignment="Center">
            <RadioButton Name="rbEuro" IsChecked="True" Content="EUR" Checked="Calculate" />
            <RadioButton Name="rbDM" Content="DM"  Checked="Calculate" />
        </StackPanel>
    </Grid>
</Window>